package com.example.kafka.controller;

import com.example.kafka.service.ProducerServiceMultiThreadSendWrong;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 反例 Controller：多线程并发消息发送
 */
@RestController
@RequestMapping("/wrong/multithread")
public class ProducerControllerMultiThreadSendWrong {

    @Autowired
    private ProducerServiceMultiThreadSendWrong service;

    @PostMapping("/send")
    public String send(@RequestParam String topic, @RequestParam String message) {
        service.sendMultiThread(topic, message);
        return "多线程消息已发送（反例）";
    }
}